module.exports = {
    sendHTTPPostRequest: function(url, data, method = "POST") {
        return new Promise(function(resolve, reject) {
            wx.request({
                url: url,
                data: data,
                method: method,
                header: {
                    'Content-Type': 'application/json'
                },
                success: function(res) {
                    if (res.statusCode == 200) {
                        resolve(res.data);
                    } else {
                        reject(res);
                    }
                },
                fail: function(err) {
                    reject(err);
                }
            })
        });
    },
};